#ifndef IO_H
#define IO_H

#include <QString>
#include <QProcess>
#include <QObject>

class IO: public QObject
{
    Q_OBJECT

private:
    QProcess * engine1 = nullptr;
    QProcess * engine2 = nullptr;
    QString path1, path2;
    int simTime;
    int mode;

    int flag1 = 0;
    int flag2 = 0;
    int who1 = 1;
    int who2 = 2;
    int layout1, layout2;
    QString lastMove;

    QString name1;
    QString name2;

    int chess[5][5];

    int simulateOnce(int first);

    void setLayout1(int layout);
    void setLayout2(int layout);
    void makeMove(int from, int to);
    int gameOver();
    int getRandom();
    void printBoard();

public:
    IO();
    ~IO();



    void loadEngine1();
    void loadEngine2();
    void sendToEngine1(const QString & cmd);
    void sendToEngine2(const QString & cmd);
    void getSimulateAmount();
    void getMode();

    void simulate();

public slots:
    void getEngineData1();
    void getEngineData2();
};



#endif // IO_H
